package demo1;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86138
 * Date: 2024-07-06
 * Time: 15:49
 */
public class Stu {
    private String name;
    private int age;
    public int num;

    private static String classname = "1班";

    //构造方法
    Stu(String name,int num, int age){
        this.num = num;
        this.age = age;
        this.name = name;
        System.out.println("构造方法");
    }

    //构造代码块
    {
        this.num = 20;
        System.out.println("构造代码块");
    }

    //静态代码块
    static{
        classname = "1";
        System.out.println("静态代码块");
    }

    //show方法
    public void show(){
        System.out.println("["+this.name+this.num+this.age+"]");
    }
}
